﻿Public Class frmTabProperties

    Private _info As XpadInfo

    Public Sub New(ByRef info As XpadInfo)

        ' This call is required by the Windows Form Designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        Dim bmp As Bitmap = My.Resources.Tab
        Me.Icon = Icon.FromHandle(bmp.GetHicon)

        _info = info

        If info.Title <> String.Empty Then
            txtTitle.Enabled = False

            txtTitle.Text = info.Title
            txtFile.Text = info.Source

            chkMonitor.Checked = _info.Monitor
        End If

    End Sub

    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
        _info.Title = txtTitle.Text
        _info.Source = txtFile.Text
        _info.Monitor = chkMonitor.Checked

        Me.DialogResult = Windows.Forms.DialogResult.OK
        Me.Dispose()
    End Sub

    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Me.DialogResult = Windows.Forms.DialogResult.Cancel
        Me.Dispose()
    End Sub

    Private Sub buttonclick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtFile.ButtonClick

        If diagFileOpen.ShowDialog() = Windows.Forms.DialogResult.OK Then
            txtFile.Text = diagFileOpen.FileName
        End If
    End Sub
End Class